<?php
/**
 * Enter description here ...
 * @author Micou13630
 *
 */
class Button extends StatefulCanvas implements IRenderable {
	
	protected $hiliteAccessKey;
	
	protected $wrap;
	
	// Function
	protected $action;
	
	
	/**
	 * Constructeur
	 * @param unknown_type $id
	 * @param unknown_type $title
	 */
	public function Button($id, $title = null) {
		parent::StatefulCanvas($id, $title);
	}
	
	/**
	 * Defini l'action du bouton
	 * @param FunctionType $func
	 */
	public function setJSAction($expression) {
		$this->action = new FunctionType(array(), $expression);
	} 
				
	/**
	 * Defini l'action du bouton
	 * @param FunctionType $func
	 */
	public function setJSActionWithConfirm($expression, $messageConfirm) {
		$this->action = new FunctionConfirmType(array(), $expression, $messageConfirm);
	} 
	
	/**
	 * Implementation de object
	 * @see IRenderable::object()
	 */
	public function object() {
		return get_class($this);
	}

	/**
	 * Implementation de properties
	 * @see IRenderable::properties()
	 */
	public function properties() {
		return parent::getProp($this);
	}
	
	/**
	 * Implementation de scLog
	 * @see IRenderable::scLog()
	 */
	public function scLog() {
		ScCollectionLog::getInstance()->addSc(new ScLog($this->object(), get_object_vars($this)));
	}

	/**
	 * Implementation de render
	 * @see IScreen::render()
	 */
	public function render() {
		$this->scLog();
		return "isc.".$this->object().".create({".$this->properties()."})";
	}
}
?>
